﻿using System;
using System.Drawing;
using MUnit;

namespace Fifteen
{
    class TestLayout
    {
        [Setup]
        void Setup()
        {
            // This will be run once before each test method
        }

        [Test]
        void ReturnsEmpty()
        {
            TLayout layout = new TLayout(1, 1, new Bitmap(300, 400));
            Verify.Equals(TLayout.EmptySquare, layout[0, 0]);
        }

        [Test]
        void DefineFinishedPlayfield()
        {
            TLayout layout = new TLayout(1, 1, new Bitmap(300, 400));
            layout[0, 0] = new Point(0, 0);

            Verify.Equals(new Point(0, 0), layout[0, 0]);
            Verify.Assert(layout.IsComplete());
        }

        [Test]
        void DefineIncompletePlayfield()
        {
            TLayout layout = new TLayout(1, 1, new Bitmap(300, 400));

            Verify.Assert(!layout.IsComplete());
        }

        [Test]
        void CreateCompletePlayfield()
        {
            TLayout layout = new TLayout(4, 4, new Bitmap(300, 400));
            layout.CreateComplete();
            Verify.Assert(layout.IsComplete());
        }

        [Test]
        void CreateRandomPlayfield()
        {
            TLayout layout = new TLayout(4, 4, new Bitmap(300, 400));
            layout.CreateRandom();
            Verify.Assert(layout.IsComplete());
        }

        [Test]
        void GetImage()
        {
            TLayout layout = new TLayout(3, 4, new Bitmap(300, 400));
            layout.CreateComplete();
            Verify.Equals(new Size(100, 100), layout.GetImageForFinalPosition(2, 3).Size);
        }

        [TearDown]
        void TearDown()
        {
            // This will be run once after each test method
        }
    }
}
